#include <iostream>
#include <algorithm>
#include <cstdio>
#include <array>
#include <vector>
#define ll long long
using namespace std;
#ifdef ONLINE_JUDGE

#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
char buf[1 << 23], *p1 = buf, *p2 = buf, ubuf[1 << 23], *u = ubuf;

#endif
int read() {
    int p = 0, flg = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') flg = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        p = p * 10 + c - '0';
        c = getchar();
    }
    return p * flg;
}
void write(ll x) {
    if (x < 0) {
        x = -x;
        putchar('-');
    }
    if (x > 9) {
        write(x / 10);
    }
    putchar(x % 10 + '0');
}
bool _stmer;

const int N = 82, len = 160 * 80 * 80;

array <ll, 2 * N * N * N> f;
array <int, N> c, t, w, idx;

array <int, N> s;

bool _edmer;
int main() {
    cerr << (&_stmer - &_edmer) / 1024.0 / 1024.0 << "MB\n";
#ifndef cxqghzj
    freopen("book.in", "r", stdin);
    freopen("book.out", "w", stdout);
#endif
    int n = read();
    for (int i = 1; i <= n; i++) c[i] = read();
    for (int i = 1; i <= n; i++) t[i] = read();
    for (int i = 1; i <= n; i++) w[i] = read();
    for (int i = 1; i <= n; i++) idx[i] = i;
    sort(idx.begin() + 1, idx.begin() + 1 + n, [&](int x, int y) {
        return (double)w[x] / t[x] > (double)w[y] / t[y];
    });
    int m = read(), res = 0, lst = 0;
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        int pos = min((m - res) / t[idx[i]], c[idx[i]]);
        ans += 1ll * max(0, pos - 80) * w[idx[i]];
        lst += max(0, pos - 80) * t[idx[i]];
        s[idx[i]] = min(c[idx[i]] - max(0, pos - 80), 160), res += pos * t[idx[i]];
    }
    for (int i = 1; i <= n; i++) {
        int tp0 = s[idx[i]];
        vector <int> tp;
        for (int j = 0; j <= 8; j++)
            if (tp0 >= (1 << j)) tp.push_back(1 << j), tp0 -= (1 << j);
        if (tp0) tp.push_back(tp0);
        for (auto k : tp)
            for (int j = len; j >= k * t[idx[i]]; j--)
                f[j] = max(f[j], f[j - k * t[idx[i]]] + 1ll * k * w[idx[i]]);
    }
    /* cerr << ans << " " << lst << endl; */
    write(ans + f[min(m - lst, len)]), puts("");
    return 0;
}
